<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
    'name' => '',
    'language' => 'vi',
    // preloading 'log' component
    'preload' => array('log', 'bootstrap', 'yiibooster'),
    // autoloading model and component classes
    'aliases' => array(
        'bootstrap' => realpath(__DIR__ . '/../extensions/bootstrap'), // change this if necessary
        'xupload' => 'ext.xupload'
    ),
    'import' => array(
        'application.models.*',
        'application.components.*',
        'application.modules.admincp.models.*',
        'application.modules.admincp.components.*',
    ),
    'modules' => array(
        'gii' => array(
            'generatorPaths' => array('bootstrap.gii'),
        ),
        'admincp',
        'user',
        'setting',
        'news',
        'video',
        'gallery',
        'adsPartners',
        'about',
        'home',
        'file'
    ),
    'defaultController' => 'home',
    // application components
    'components' => array(
        'bootstrap' => array(
            'class' => 'bootstrap.components.Bootstrap',
        ),
        'user' => array(
            'allowAutoLogin' => true,
            'loginUrl' => array('/admincp/login'),
        ),
        'db' => array(
            'connectionString' => 'mysql:host=localhost;dbname=data_namgiang',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => 'cms_',
        ),
        'errorHandler' => array(
            // use 'site/error' action to display errors
            'errorAction' => 'site/error',
        ),
        'authManager' => array(
            'class' => 'CDbAuthManager',
            'connectionID' => 'db',
            'assignmentTable' => 'cms_authassignment',
            'itemTable' => 'cms_authitem',
            'itemChildTable' => 'cms_authitemchild'
        ),
        'urlManager' => array(
            'urlFormat' => 'path',
            'showScriptName' => FALSE,
            'urlSuffix' => FALSE,
            'rules' => array(
                '<detail:.*?>-<id:\d+>' => array('home/news/detail', 'urlSuffix' => '.html'),
                'gioi-thieu/<alias:.*?>' => array('home/about/detail', 'urlSuffix' => '.html'),
                '<linkViewNews:.*?>-c<id:\d+>' => array('home/news/view', 'urlSuffix' => '.html'),
                '<alias:.*?>-f<id:\d+>' => array('home/file/view', 'urlSuffix' => '.html'),
                'hinh-anh' => array('home/gallery/view', 'urlSuffix' => '.html'),
                'lien-he' => array('home/contact/contact', 'urlSuffix' => '.html'),
                'search' => array('home/search/view'),
                'change_pass' => 'user/profile/changepassword',
                'edit' => 'user/profile/edit',
                'profile' => 'user/profile',
                '<controller:\w+>/<action:\w+>/<id:\d+>/<alias:.*?>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
                'admincp/<modules:\w+>/<controller:\w+>/<action:\w+>' => '<modules>/<controller>/<action>',
                'admincp/<modules:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<modules>/<controller>/<action>',
            ),
        ),
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute',
                    'levels' => 'error, warning',
                ),
            // uncomment the following to show log messages on web pages
            /*
              array(
              'class'=>'CWebLogRoute',
              ),
             */
            ),
        ),
        'phpThumb' => array(
            'class' => 'ext.EPhpThumb.EPhpThumb',
            'options' => array(),
        ),
    ),
    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params' => require(dirname(__FILE__) . '/params.php'),
);